package com.service.impl;

import com.entity.RoleEmployee;
import com.mapper.RoleEmployeeMapper;
import com.service.RoleEmployeeService;
import com.vo.InterceptorAuthorityVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author aiou
 * @since 2025-06-12
 */
@Service
public class RoleEmployeeServiceImpl implements RoleEmployeeService {

    @Autowired
    private RoleEmployeeMapper roleEmployeeMapper;

    //删除角色员工关系
    @Override
    public boolean removeByRoleId(Integer roleId) {
        return roleEmployeeMapper.deleteByRoleId(roleId);
    }

    //查询角色员工关系
    @Override
    public List<RoleEmployee> list(Integer roleId) {
        return roleEmployeeMapper.selectByRoleId(roleId);
    }

    //删除原有角色
    @Override
    public boolean remove(Integer roleId) {
        return roleEmployeeMapper.deleteByRoleId(roleId);
    }

    //保存角色员工关系
    @Override
    public boolean save(RoleEmployee roleEmployee) {
        return roleEmployeeMapper.save(roleEmployee);
    }

    //根据用户Id查询所有权限
    @Override
    public List<InterceptorAuthorityVO> interceptorAuthorityList(Integer employeeId) {
        return roleEmployeeMapper.interceptorAuthorityList(employeeId);
    }
}
